<template>
	<view :class="['vh100',{'dark':theme == 'dark'}]">
		
		
		<siginIn :sign_list="sign_list" @click="getsigin" :count="data2222.count" :today="data2222.isToday" :coin="config.rewrdCoin"></siginIn>
		
	</view>
</template>


<script>
	import siginIn from '../../components/fanxiao-sign/sigin-in.vue';
	import {
		mapState,
		mapActions,
		mapGetters
	} from 'vuex';
	import {
		checkIn,checkInfo,chenkDayConfig,
	} from '../../common/apiString.js'
	import {
		myMixins
	} from '@/common/myMixins.js' //加入全局下拉刷新
	export default {
		mixins: [myMixins],
		data() {
		        return {
					config:{
					  one:"",
					  two:'',
					  three:'',
					  four:'',
					  five:'',
					  six:'',
					  seven:'',
					  rewrdCoin:this.$t("bico.refresh")
					},
					data2222:{
					  awardInfo: "",
					  count: 4,
					  days: [12, 11, 10, 9, 7, 6],
					  isToday: "Y",
					},
		            sign_list: [
		                {
		                    discount: '10',
		                    day: '1'
		                },
		                {
		                    discount: '20',
		                    day: '2'
		                },
		                {
		                    discount: '30',
		                    day: '3'
		                },
		                {
		                    discount: '40',
		                    day: '4'
		                },
		                {
		                    discount: '50',
		                    day: '5'
		                },
		                {
		                    discount: '60',
		                    day: '6'
		                },
						{
						    discount: '120',
						    day: '7'
						}
		            ]
		        };
		    },
		computed: {
			...mapState({
				theme: state => state.theme
			}),
		},
		onLoad() {
			uni.setNavigationBarTitle({
				title: this.$t('bico.W712'),
			})
			this.$utils.setTheme(this.theme);
			this.getChenkDayConfig()
			this.getCheckInfo()
		},
		methods: {
			getChenkDayConfig() {
				this.$utils.initDataToken({url:chenkDayConfig,type:'post'},(res,msg)=>{
					this.sign_list[0].discount=res.one
					this.sign_list[1].discount=res.two
					
					this.sign_list[2].discount=res.three
					this.sign_list[3].discount=res.four
					this.sign_list[4].discount=res.five
					this.sign_list[5].discount=res.six
					this.sign_list[6].discount=res.seven
					this.config = res
					
				})
			},
			doCheckIn() {
				this.$utils.initDataToken({url:checkIn,type:'post'},(res,msg)=>{
					this.$utils.showLayer(this.$t("bico.W786"));
					
					this.getChenkDayConfig()
					this.getCheckInfo()
				})
			},
			getCheckInfo() {
				this.$utils.initDataToken({url:checkInfo,type:'post'},(res,msg)=>{
					this.data2222 = res
				})
			},
			getsigin(e) {
			    console.log(this.$t("bico.W787"));
				if(this.data2222.isToday=="N"){
					this.doCheckIn()
				}else{
					this.$utils.showLayer(this.$t("bico.W788"));
				}
				
				
			}
			
		},
		components: {
		    siginIn
		},
	}
</script>


<style scoped>
.vh100{
 background-image: url(/static//bg.png); background-position: 0% 0%; background-size: 100% 100%; background-repeat: no-repeat;
}

</style>
